TypeScript 2.x for Angular Developers by Christian Nwamba
Author: Christian Nwamba [Christian Nwamba] , Date: December 2, 2026
, Views: 3
Data in components
To better understand the importance of services and DI, let's create a simple app with a component that shows a list of user comments. Once you have an app created, you can run the following command to generate the required component:
ng g component comment-list
Update the component's code with the following snippet:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-comment-list',
templateUrl: './comment-list.component.html',
styleUrls: ['./comment-list.component.css']
})
export class CommentListComponent implements OnInit {
Copyright Disclaimer:
This site does not store any files on its server. We only index and link
to content provided by other sites. Please contact the content providers
to delete copyright contents if any and email us, we'll remove relevant
links or contents immediately.